package site.wanjiahao.handler.client;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import site.wanjiahao.app.Client;
import site.wanjiahao.message.response.ChartResponseMessage;

@ChannelHandler.Sharable
public class ChartResponseMessageHandler extends SimpleChannelInboundHandler<ChartResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, ChartResponseMessage msg) throws Exception {
        if (msg.isSuccess()) {
            System.out.println(msg.getFrom() + ": " + msg.getContent());
        } else {
            System.out.println(msg.getReason());
        }
    }
}
